package com.wzh.easyapi.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wzh.easyapi.bean.SqlManage;
import com.wzh.easyapi.dto.SqlManageDTO;
import com.wzh.easyapi.mapper.SqlManageMapper;
import com.wzh.easyapi.service.SqlManageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * SQL 管理服务实现类
 */
@Service
public class SqlManageServiceImpl extends ServiceImpl<SqlManageMapper, SqlManage> implements SqlManageService {
    @Autowired
    private SqlManageMapper sqlManageMapper;

    /**
     * 自定义分页查询
     *
     * @param pageNum  页码
     * @param pageSize 每页记录数
     * @param path     请求路径（可选）
     * @return 分页结果
     */
    @Override
    public Page<SqlManageDTO> getSqlManagePage(int pageNum, int pageSize, String path) {
        Page<SqlManageDTO> page = new Page<>(pageNum, pageSize);
        return sqlManageMapper.getSqlManageWithDataSource(page, path);
    }
}
